Skip to content

fix: Tuple serialization#50

Merged
IvanMurzak merged 6 commits into
mainfrom
fix/serialization-issue
Jan 7, 2026
Merged

fix: Tuple serialization#50
IvanMurzak merged 6 commits into
mainfrom
fix/serialization-issue

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

This pull request introduces a specialized converter for ValueTuple and Tuple types and improves the handling of indexer properties during serialization. It also adds comprehensive tests for ValueTuple reflection and serialization behavior. The most important changes are grouped below.

Tuple and ValueTuple Serialization Improvements

  • Added a new TupleReflectionConverter class that specializes in serializing types implementing ITuple (such as ValueTuple and Tuple). This converter filters out indexer properties that cannot be serialized directly, preventing serialization issues. (ReflectorNet/src/Converter/Reflection/TupleReflectionConverter.cs)
  • Registered the new TupleReflectionConverter in the Reflector.Registry to ensure it is used for relevant types. (ReflectorNet/src/Reflector/Reflector.Registry.cs)

Indexer Property Filtering

  • Updated property filtering logic in the base reflection converter to exclude indexer properties, ensuring only serializable properties are processed. (ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs)

Logging and Diagnostics

  • Improved logging in the serialization process to include indentation (padding) and converter type, making debugging easier when serialization fails for fields or properties. (ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.Serialize.cs) [1] [2]

Testing Enhancements

  • Added a comprehensive test suite for ValueTuple reflection and serialization, including property and field listing, interface mapping, indexer filtering, and converter selection logic. (ReflectorNet.Tests/src/ReflectorTests/ValueTuplePropertiesTests.cs)

Minor Cleanup

  • Removed commented-out logging code from the array reflection converter for clarity. (ReflectorNet/src/Converter/Reflection/ArrayReflectionConverter.cs)

@IvanMurzak IvanMurzak requested a review from Copilot January 7, 2026 10:24
@IvanMurzak IvanMurzak self-assigned this Jan 7, 2026
@IvanMurzak IvanMurzak added the bug Something isn't working label Jan 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 7, 2026

Test Results

    2 files  ±  0      2 suites  ±0   3m 57s ⏱️ -3s
1 033 tests + 69  1 033 ✅ + 69  0 💤 ±0  0 ❌ ±0 
2 066 runs  +138  2 066 ✅ +138  0 💤 ±0  0 ❌ ±0 

Results for commit d146d4e. ± Comparison against base commit 627d085.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes tuple serialization issues by introducing a specialized TupleReflectionConverter for ValueTuple and Tuple types that implement the ITuple interface. The main problem addressed is that tuples have indexer properties from the ITuple interface that cannot be serialized directly, causing serialization failures.

Key Changes:

  • Added TupleReflectionConverter to filter out indexer properties for tuple types
  • Updated base converter to filter indexer properties globally
  • Enhanced logging to include converter type and padding for better debugging

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ReflectorNet/src/Converter/Reflection/TupleReflectionConverter.cs New specialized converter that handles ITuple types with higher priority than generic converter
ReflectorNet/src/Reflector/Reflector.Registry.cs Registers the new TupleReflectionConverter in the converter registry
ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Adds global indexer property filtering to prevent serialization issues
ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.Serialize.cs Improves error logging with padding and converter type information
ReflectorNet/src/Converter/Reflection/ArrayReflectionConverter.cs Removes commented-out logging code
ReflectorNet.Tests/src/SchemaTests/TupleSchemaTests.cs Comprehensive schema tests for tuples with 1-8 elements, nested tuples, and arrays
ReflectorNet.Tests/src/ReflectorTests/ValueTupleSerializationTests.cs Serialization and round-trip tests for ValueTuple and Tuple types
ReflectorNet.Tests/src/ReflectorTests/ValueTuplePropertiesTests.cs Tests for property reflection, converter selection, and indexer filtering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ReflectorNet/src/Converter/Reflection/TupleReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/TupleReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/TupleReflectionConverter.cs Outdated
Comment thread ReflectorNet.Tests/src/ReflectorTests/ValueTuplePropertiesTests.cs Outdated
@IvanMurzak IvanMurzak merged commit b352bb6 into main Jan 7, 2026
2 checks passed
@IvanMurzak IvanMurzak deleted the fix/serialization-issue branch January 7, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants